package cn.zane.designPattern.behaviorPatterns.commandPatterns.design;

import cn.zane.designPattern.behaviorPatterns.commandPatterns.design.cuisine.ICuisine;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zane
 * @date 2025/01/22
 * @Description
 */
public class XiaoEr {

    // 客人点的菜单
    private List<ICuisine> cuisineList = new ArrayList<>();

    public void order(ICuisine cuisine) {
        cuisineList.add(cuisine);
    }

    public synchronized void placeOrder() {
        for (ICuisine cuisine : cuisineList) {
            cuisine.cook();
        }
        cuisineList.clear();
    }
}
